package com.eqdd.yiqidian.ui.act

import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.View
import com.eqdd.yiqidian.R
import com.eqdd.yiqidian.adapter.MyFragmentPagerAdapter
import com.eqdd.yiqidian.base.BaseActivity
import com.eqdd.yiqidian.base.Config
import kotlinx.android.synthetic.main.activity_space_preview.*

/**
 * Created by jhj on 18-9-25.
 */
class ActListActivity : BaseActivity() {
    override fun initBinding() {
        setContentView(R.layout.activity_act_list)
        initTopTitleBar(View.VISIBLE, "活动")
        /*iv_search.visibility = View.VISIBLE
        iv_search.onClick {
            startActivity<RequestSearchActivity>()
        }*/
    }

    override fun initData() {


    }

    override fun setView() {
        val list = arrayListOf<String>("最新发布", "报名最多", "高度关注")
        val fragment = arrayListOf<Fragment>()
        fragment.add(getFragment(0))
        fragment.add(getFragment(1))
        fragment.add(getFragment(2))
        // 第二步：为ViewPager设置适配器
        vp_pager.adapter = MyFragmentPagerAdapter(supportFragmentManager, list, fragment)
        //  第三步：将ViewPager与TableLayout 绑定在一起
        tl_tab.setupWithViewPager(vp_pager)

    }


    fun getFragment(status: Int): Fragment {
        val bundle = Bundle()
        val fragment = ActListFragment()
        bundle.putInt(Config.STATUS, status)
        bundle.putString(Config.GUID, user.guid)
        fragment.arguments = bundle
        return fragment
    }
}